package lotterysystem.lotterysystem.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lotterysystem.lotterysystem.common.errorcode.ErrorCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {

    /**
     * 异常码
     * @see lotterysystem.lotterysystem.common.errorcode.ControllerErrorCodeConstants
     */
    private  Integer code;

    /**
     * 异常信息
     */
    private  String msg;

    public ControllerException() {

    }

    public ControllerException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getErrorCode();
        this.msg = errorCode.getErrorMessage();
    }
}
